﻿using System;
using System.Collections.Generic;
using System.Text;
using Pahan.McuFusion.Common;

namespace Pahan.McuFusion.Atmel.Avr
{
    public sealed class AvrProgrammerInfo // : AtmelProgrammerInfo
    {/*
        #region Overrides of BaseInfo

        public override string Name
        {
            get
            {
                return "AVR SPI Programmer";
            }
        }

        public override string Description
        {
            get
            {
                return String.Empty;
            }
        }

        #endregion

        #region Overrides of ProgrammerInfo

        /// <summary>
        /// Gets the list of the supported microcontrollers.
        /// </summary>
        public override IList<DeviceInfo> SupportedMicrocontrollers
        {
            get
            {
                return new[]
                {
                    atmega8515,
                };
            }
        }

        /// <summary>
        /// Creates an instance of the programmer.
        /// </summary>
        /// <param name="mcu">Target microcontroller.</param>
        /// <param name="adapter">Target adapter.</param>
        /// <returns></returns>
        public override IProgrammer CreateProgrammer(DeviceInfo mcu, IHardwareAdapter adapter)
        {
            Assert.NotNull(mcu, "mcu");
            Assert.OfType<AvrMcuInfo>(mcu, "mcu");
            Assert.NotNull(adapter, "adapter");
            Assert.OfType<IAtmelSpiAdapter>(adapter, "adapter");
            if (atmega8515.Equals(mcu))
            {
                return new AvrWithPagedMemoryProgrammer(
                    mcu as AvrMcuInfo, this, adapter as IAtmelSpiAdapter);
            }
            throw new NotSupportedException("This MCU is not supported.");
        }

        /// <summary>
        /// Checks whethes the specified hardware adapter is supported by the programmer.
        /// </summary>
        public override bool Supports(HardwareAdapterInfo hardwareAdapter)
        {
            return hardwareAdapter.Implements<IAtmelSpiAdapter>();
        }

        #endregion

        private static AvrMcuInfo atmega8515 = new AvrMcuInfo(
            "ATMega 8515", new[]
            {
                new MemoryClassInfo("Program Memory", 8192, 64),
                new MemoryClassInfo("EEPROM", 512,  4)
            })
        {
            EepromDelay = 9000,
            EraseDelay = 9000,
            FlashDelay = 4500,
        };*/
    }
}
